

CURTIME=`date +%m%d%H%M`

CURTIME=${CURTIME}_$1
SAVEDLOG=4core_pcie_log/$CURTIME
log_file=$SAVEDLOG/4_core_pcie_log.log_all

mkdir -p $SAVEDLOG
if [ -e $log_file ];then
    rm -rf $log_file
fi

echo "app run start..." | tee -a $log_file

echo " " | tee -a $log_file



echo "-----------TEST card_id:$card_id-------------" | tee -a $log_file

sh 4_core_pcie.sh | tee -a $log_file

echo "" | tee -a $log_file
echo "" | tee -a $log_file

echo "------------TEST REPORT------------------------"  | tee -a $log_file



result=$(cat $log_file | grep -c 'Summary:')
length=$(expr length "$result")
echo "result is $result"

if [[ $result -ne 2 ]];
then
        echo -e "ALL CARD TEST RESULT: \E[31m [FAILED] \E[0m" | tee -a $log_file
else
        echo -e "ALL CARD TEST RESULT: \E[32m [PASS] \E[0m" | tee -a $log_file
fi

